package com.bjpowernode.rbac.web.controller;

import com.bjpowernode.rbac.entity.Employee;
import com.bjpowernode.rbac.service.EmployeeService;
import com.bjpowernode.rbac.util.ReturnObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author jy
 * @version 1.0
 * @date 2022/2/10 21:28
 */
@Controller
@RequestMapping("/user")
public class UserController {

    @Autowired
    private EmployeeService employeeService;

    @RequestMapping("/login")
    @ResponseBody
    public ReturnObject login(String username,String password){
        employeeService.login(username,password);
        return new ReturnObject();
    }


    @RequestMapping("/logout")
    public String login(){
        employeeService.logout();
        return "redirect:/login.html";
    }

}
